from peewee import *
db = PostgresqlDatabase(
    'bookloft',  # Required by Peewee.
    user='bookloft',  # Will be passed directly to psycopg2.
    password='bookloft',  # Ditto.
    host='127.0.0.1')  # Ditto.)
class Category(Model):
    id = IntegerField(primary_key=True)
    name = CharField(max_length=32)
    obj_id = IntegerField()
    site = CharField(max_length=32)
    class Meta:
        database = db
        table_name = 'app_category'


a = Category.get_or_none(Category.obj_id == 115, Category.site == 'sjqq')
if not a:
    print('save')
    a = dict(obj_id=115,name='hello',site='sjqq')
    print(a)
    Category.create(**a)
else:
    print(a)